﻿CREATE PROCEDURE [dbo].[proc_Loan_GetListBYUserId]
	(
		@userid VARCHAR(10),
		@summary NVARCHAR(100)
	
	)
AS
begin
	
	
	
	;WITH list As( SELECT 
	  ROW_NUMBER() OVER (ORDER BY lrrq desc)AS Row
	  ,id,[CompanyId]
      ,[CompanyName]
      ,[DepartmentId]
      ,[DepartmentName]
      ,[ENameId]
      ,[EName]
      ,[Address]
      ,[Days]
      ,[Money]
      ,[Cause]
      ,[lrrq]
      ,[userid]
      ,[username]
      ,[Summary] FROM Loan WHERE flag=0 and ENameId=@userid AND Summary LIKE '%'+@summary+'%' )
      
      select * from list 
     	
end			
	RETURN
